#向后端发送的json数据格式如下
#
"""
URL configuration for short_video_platform project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from accounts import views as account_views
from home import views as home_views
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('admin/', admin.site.urls),
    path('accounts/', include('accounts.urls')),
    path('discover/', account_views.discover_view, name='discover'),
    path('', account_views.home, name='home'),
    # 新增：登录成功跳转的个人主页
    path('profile/', account_views.profile_view, name='profile'),
    # 热门页与占位 API
    path('hot/', home_views.hot_view, name='hot'),
    path('api/hot-videos/', home_views.api_hot_videos, name='api_hot_videos'),
    # 关注页（需登录）
    path('following/', home_views.following_view, name='following'),
    # 前端统一往此处发送 JSON，我们在后端转发到 mock backend
    path('api/request', account_views.api_request_proxy, name='api_request'),
    path('api/request/', account_views.api_request_proxy),  # 兼容带斜杠
    # 本地视频文件上传
    path('api/upload-video-file', account_views.upload_video_file, name='upload_video_file'),
    # 本地视频文件删除（仅限 MEDIA_ROOT/videos 下）
    path('api/delete-video-file', account_views.delete_video_file, name='delete_video_file'),
]

# 开发环境静态服务用户上传的媒体文件
if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
